<?php session_start();
include "./configs/config.php";
if(empty($_POST['username']) || empty($_POST['password']))
 {
     ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<head>
<meta http-equiv="refresh" content="2; URL=index.html">
<title>
</title>
</head>
</body>

<h1>Fill up both fields for username and password.<h1><br>

Redirecting to login page....
</html>
 <?    
 }
 else{
 
  $username=trim($_POST['username']);
  $password=trim($_POST['password']);
  $query=mysql_query("SELECT * FROM UserLogInInfo WHERE UserName='$username' AND Password='$password'"); 
  $num=mysql_num_rows($query); 
  if($num > 0)
  {
    $data=mysql_fetch_array($query);
  $_SESSION['userid']=$data['EmployeeID'];
  echo " <h1>Logged in successfully</h1>";
  echo "You will be redirected to the $username dashnoard after few seconds";
  	
  
  
?>
<html>
<body>
<head>
<meta http-equiv="refresh" content="2; URL=dashboard.php">
<title>
</title>
</head>
</body>
</html>

<?
}

else{
    echo "<h1>Wrong username or password</h1><br>";
    echo "You will be redirected to the login page after few seconds";
    ?>   
    
    <html>
<body>
<head>
<meta http-equiv="refresh" content="5; URL=index.html">
<title>
</title>
</head>
</body>
</html>

<?    
}
}

?>